<template>
	<view style="width: 100%;background-color: #F7F7F7;min-height: 100vh;">

		<view class="head_box"
			:style="'background:url('+imageSrc+') no-repeat;background-size: 100%;background-position: 0;'">
			<view class="" :style="{height: naviBarHeight}">
			</view>
		<!-- 	<view class="right_icon">
				<u-icon @click="handNavTo('/pages/message/message')" name='bell' color="#fff" size="48"></u-icon>
				<image @click="handlePreviewImage" class="icon" src="../../static/img/qrcode.png" mode=""></image>
				<image @click="handNavTo('/pages/setting/setting')" class="icon" src="../../static/img/setting-fill.png"
					mode=""></image>
			</view> -->
			<view class="" @click="navToUserMsgDetail">
				<image :src="userInfo.imgUrl" class="head_img" mode=""></image>
				<view class="name_box">
					<view class="name">
						{{userInfo.name}}
					</view>
				</view>
			</view>
		</view>
	<view class="" style="padding: 0 24rpx;">
		<u-button @click="signOut" type="primary" style="margin-top: 25rpx;width: 100%;">退出登录</u-button>
	
	</view>

	</view>
</template>

<script>
	import cacheFunc from '@/utils/cache.js'
	import {
		logOut
	} from '@/utils/logOut.js'
	import GoodsItemRow from '@/components/ZY-Goods-item-row/ZY-Goods-item.vue'
	import ZYTitle from '@/components/ZY-title/ZY-title.vue'
	import initData from '@/mixin/initData.js'
	export default {
		mixins: [initData],
		components: {
			GoodsItemRow,
			ZYTitle
		},
		data() {

			return {
				imageSrc: '../../static/img/mybg.png',
				userInfo: {},
				integral: 0
			};

		},
		onShow() {
			const userInfo = this.cache.getCache('busUserInfo')
			console.log(userInfo, '用户信息')
			if (userInfo) {
				this.userInfo = userInfo
			} else {
				this.cache.removeCache('busToken')
				this.cache.removeCache('busUserInfo')
				uni.showToast({
					title: '尚未登录,请登录',
					icon: 'none'
				})
				// code-10400 用户未登录
				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/login/login'
					})
				}, 1000)
			}

		},
		mounted() {


		},
		methods: {
			signOut() {
				cacheFunc.removeCache('token')
				cacheFunc.removeCache('busUserInfo')
				uni.showToast({
					title: '退出成功',
					icon: 'none'
				})
				uni.redirectTo({
					url: '/pages/login/login'
				})
			},
			gitMyIntegralDetails() {
				this.$u.api.myIntegralDetails().then(res => {
					console.log(res, 'jifen')
					this.integral = res.integral
				})

			},
			navToUserMsgDetail() {
				// uni.navigateTo({
				// 	url: '/pages/userMsg/userMsg'
				// })
			},
			handAfterSale() {
				uni.navigateTo({
					url: '/pages/afterSale/afterSale'
				})

			},
			handNavToDetails(item) {
				uni.navigateTo({
					url: '/pages/followShop/goodsDetail/goodsDetail?id=' + item.id,

				})
			},
			// 请求前的参数处理
			beforeInit() {
				this.apiUrl = "carouselMap/getGoodGoodsList";
				let params = {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
				};

				this.params = {
					...params
				};
			},
			// 查看二维码
			handlePreviewImage() {
				uni.previewImage({
					current: 0,
					urls: [this.userInfo.qrCode]

				})
			},
			handNavTo(url) {
				uni.navigateTo({
					url
				})
			},
			navToIntegral() {
				uni.navigateTo({
					url: '/pages/integral/integral'
				})
			},
			handAllOrder(current) {
				uni.navigateTo({
					url: `/pages/order/order?current=${current}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.item_row {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}

	.code_bg {
		height: 280rpx;
		width: 100%;
		background: url(../../static/img/yaoqingBG.png) no-repeat;
		background-size: 100%;
		position: relative;

		.invitation_code {
			position: absolute;
			left: 300rpx;
			top: 66rpx;
			color: #FBF2E1;
			font-size: 60rpx;

			font-weight: 600;
			text-align: center;
		}
	}

	.content {
		padding: 0 30rpx;
		margin-bottom: 16rpx;
	}

	.business_box {
		background-color: #fff;
		margin: 16rpx 0;
		padding: 50rpx 24rpx !important;
	}

	.order_list {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30rpx 24rpx;

		.item {
			position: relative;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			.title {
				margin-top: 7rpx;
				font-size: 26rpx;
				color: #000000;
			}

			.icon {
				width: 70rpx;
				height: 70rpx;

			}
		}
	}

	.order_box {
		background-color: #FFFFFF;
		border-radius: 20rpx;
		margin-top: -100rpx;

		.order_top {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 24rpx;

			.all_order {
				font-size: 24rpx;
				color: #919191;
			}

			.title {
				font-size: 28rpx;
				color: #000000;
				font-weight: 700;

			}
		}
	}

	.head_box {
		height: 458rpx;
		// background: url(../../static/img/mybg.png) no-repeat;
		// background-size: 100% 100%;

		width: 100%;
		padding: 30rpx;
		text-align: center;
		padding-top: 0;

		.name_box {
			display: flex;
			align-items: center;
			justify-content: center;

			.vip {
				// display: flex;
				width: 106rpx;
				height: 36rpx;
				text-align: center;
				line-height: 36rpx;
				margin-left: 12rpx;
				background: url(../../static/img/ordinary_vip.png) no-repeat;
				background-size: 100%;
				font-size: 24rpx;
				color: #fff;
			}

			.ordinary_vip {
				background: url(../../static/img/vip.png) no-repeat;

				background-size: 100%;
			}

			.name {
				font-size: 36rpx;
				color: #fff;
			}
		}


		.head_img {
			width: 140rpx;
			height: 140rpx;
			border-radius: 50%;
			marign-bottom: 18rpx;
		}

		.right_icon {
			display: flex;
			align-items: center;
			justify-content: flex-end;

			.icon {
				width: 44rpx;
				height: 44rpx;
				margin-left: 40rpx;
			}
		}
	}
</style>
